Skip to content

Resolve issue #13 Add test, reproducible Apps Script build pipeline with coverage-validated CI#19

Merged
demmings merged 10 commits into
demmings:mainfrom
benjaminpo:chore/test-and-build-pipeline
Jul 9, 2026
Merged

Resolve issue #13 Add test, reproducible Apps Script build pipeline with coverage-validated CI#19
demmings merged 10 commits into
demmings:mainfrom
benjaminpo:chore/test-and-build-pipeline

Conversation

@benjaminpo

Copy link
Copy Markdown
Contributor

Summary

  • Added a deterministic build pipeline that generates dist/CacheFinance.js from src/, strips Node-only DEBUG blocks, validates bundle content, and skips rewriting unchanged output.
  • Added build/check/validate npm scripts and wired CI to run validate so stale bundles fail fast before merge.
  • Expanded and documented the local development workflow (build, check, test, coverage) in the README.

Test plan

  • npm run build
  • npm run build:check
  • npm run validate
  • Confirm dist/CacheFinance.js updates only when source content changes

- Created package.json and package-lock.json for project dependencies and scripts.
- Updated .gitignore to exclude node_modules and coverage directories.
- Added initial development scripts for building and testing the project.
- Updated README instructions for authorizing the script.
- Removed optional manual testing functions from CacheFinance.js to streamline the codebase.
- Updated gas-source.mjs to validate exclusion of test helpers from the bundle.
- Added tests to ensure optional test functions are not included in the final bundle.
@benjaminpo benjaminpo changed the title Resolve #13 Add reproducible Apps Script build pipeline with coverage-validated CI Resolve #13 Add test, reproducible Apps Script build pipeline with coverage-validated CI Jul 8, 2026
- Bump package version to 1.0.1 in package-lock.json.
- Update devDependency "@vitest/coverage-v8" to version 3.2.7.
- Simplify error handling in ScriptSettings and GasMocks by removing exception parameters.
- Add clear methods to ScriptCache and ScriptProperties with documentation.
- Modify test setup to prevent unnecessary logging and improve clarity in test cases.
…s and ScriptSettings

- Removed branch restrictions from the GitHub Actions workflow for pushes.
- Updated the workflow to include a verification step for the bundle and run unit tests with coverage.
- Added detailed JSDoc comments for new methods in GasMocks and ScriptSettings to improve code clarity and maintainability.
@benjaminpo benjaminpo changed the title Resolve #13 Add test, reproducible Apps Script build pipeline with coverage-validated CI Resolve issue #13 Add test, reproducible Apps Script build pipeline with coverage-validated CI Jul 8, 2026
…asMocks

- Simplified error handling in various API classes by removing exception parameters from catch blocks.
- Updated documentation in GasMocks to include JSDoc comments for new methods, improving code clarity and maintainability.
- Updated source hash in CacheFinance.js to reflect recent changes.
- Simplified error handling in FinanceSiteLookupAnalyzer by removing exception parameters from catch blocks.
- Updated documentation in build-cachefinance.mjs and GasMocks to include JSDoc comments for new methods, improving code clarity.
- Adjusted validation logic in gas-source.mjs to accommodate whitespace variations in import/export statements.
- Updated source hash in CacheFinance.js to reflect recent changes.
- Introduced a JSDoc comment to document the in-memory mock for Apps Script script cache storage in the GasMocks.js file, enhancing code clarity and maintainability.
Comment thread .github/workflows/sonar.yml Fixed
@benjaminpo
benjaminpo force-pushed the chore/test-and-build-pipeline branch from 2c6b1ef to 87a029c Compare July 8, 2026 10:14
…inanceWebSites

- Bump package version to 1.1.0 in package.json and package-lock.json.
- Rename test FinanceWebSites to CacheFinanceWebSites
- Added .vscode/ to .gitignore to prevent IDE-specific files from being tracked in the repository.
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@demmings

demmings commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Hey Ben,

Just wondering what is going on with these changes? Is this fixing something? I see some stuff relating to NPM, which is something I thought was needed to distribute years ago, but it is not usefuly and I was going to remove, but never got around to it. I am not really up to speed the tests. Are they somehow run when you make a change? Currently when I have an update for git, I just run a script to make the DIST version by stripping out stuff Google apps script can't process. Is all this solving something?

@demmings
demmings merged commit 6320ec0 into demmings:main Jul 9, 2026
3 checks passed
@benjaminpo

benjaminpo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Hey Chris,

Thanks for merging — to answer your questions briefly:

Nothing changes for end users. dist/CacheFinance.js is still what goes into Apps Script.

npm isn’t for distribution (private: true). It’s only for tooling: the build script that strips DEBUG blocks and concatenates src/ into dist/ (same idea as your manual script), plus Vitest for unit tests.

Tests run in Node with mocked Apps Script APIs — locally via npm test, and automatically on push/PR in GitHub Actions. They don’t run inside Sheets.

What it solves: a repeatable build for easier contributors' contributions, a check that dist/ stays in sync with src/, and tests to catch regressions without live spreadsheet runs. A few small cleanups along the way (import paths, test helpers moved out of the bundle).

@benjaminpo
benjaminpo deleted the chore/test-and-build-pipeline branch July 10, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants